package com.raylu.day08;

import com.raylu.utils.ClickSource;
import org.apache.flink.runtime.state.filesystem.FsStateBackend;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Example1SetCheckPoint {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        // 每隔10秒钟，保存一次检查点
        // 每隔10秒钟，注入一次检查点分界线
        env.enableCheckpointing(10 * 1000L);
        // 设置保存检查点的文件夹的路径
        env.setStateBackend(new FsStateBackend("file:///home/zuoyuan/flinktutorial0701/src/main/resources/ckpts", false));

        env.addSource(new ClickSource()).print();

        env.execute();
    }
}
